/*
Copyright (C) 1997-2001 Id Software, Inc.

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  

See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/

// Created on 31.10.2003 by RST.
// $Id: moveinfo_t.java,v 1.2 2004/08/20 21:29:58 salomo Exp $
using System;
using QuakeFile = Suake2.UI.util.QuakeFile;
namespace Suake2.UI.game
{
	
	public class moveinfo_t
	{
		// fixed data
		internal float[] start_origin = new float[]{0, 0, 0};
		internal float[] start_angles = new float[]{0, 0, 0};
		internal float[] end_origin = new float[]{0, 0, 0};
		internal float[] end_angles = new float[]{0, 0, 0};
		
		internal int sound_start;
		internal int sound_middle;
		internal int sound_end;
		
		internal float accel;
		internal float speed;
		internal float decel;
		internal float distance;
		
		internal float wait;
		
		// state data
		internal int state;
		internal float[] dir = new float[]{0, 0, 0};
		
		internal float current_speed;
		internal float move_speed;
		internal float next_speed;
		internal float remaining_distance;
		internal float decel_distance;
		internal EntThinkAdapter endfunc;
		
		/// <summary>saves the moveinfo to the file.</summary>
		public virtual void  write(QuakeFile f)
		{
			f.writeVector(start_origin);
			f.writeVector(start_angles);
			f.writeVector(end_origin);
			f.writeVector(end_angles);
			
			System.IO.BinaryWriter temp_BinaryWriter;
			temp_BinaryWriter = new System.IO.BinaryWriter(f);
			temp_BinaryWriter.Write((System.Int32) sound_start);
			System.IO.BinaryWriter temp_BinaryWriter2;
			temp_BinaryWriter2 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter2.Write((System.Int32) sound_middle);
			System.IO.BinaryWriter temp_BinaryWriter3;
			temp_BinaryWriter3 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter3.Write((System.Int32) sound_end);
			
			System.IO.BinaryWriter temp_BinaryWriter4;
			temp_BinaryWriter4 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter4.Write((System.Single) accel);
			System.IO.BinaryWriter temp_BinaryWriter5;
			temp_BinaryWriter5 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter5.Write((System.Single) speed);
			System.IO.BinaryWriter temp_BinaryWriter6;
			temp_BinaryWriter6 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter6.Write((System.Single) decel);
			System.IO.BinaryWriter temp_BinaryWriter7;
			temp_BinaryWriter7 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter7.Write((System.Single) distance);
			
			System.IO.BinaryWriter temp_BinaryWriter8;
			temp_BinaryWriter8 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter8.Write((System.Single) wait);
			
			System.IO.BinaryWriter temp_BinaryWriter9;
			temp_BinaryWriter9 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter9.Write((System.Int32) state);
			f.writeVector(dir);
			
			System.IO.BinaryWriter temp_BinaryWriter10;
			temp_BinaryWriter10 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter10.Write((System.Single) current_speed);
			System.IO.BinaryWriter temp_BinaryWriter11;
			temp_BinaryWriter11 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter11.Write((System.Single) move_speed);
			System.IO.BinaryWriter temp_BinaryWriter12;
			temp_BinaryWriter12 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter12.Write((System.Single) next_speed);
			System.IO.BinaryWriter temp_BinaryWriter13;
			temp_BinaryWriter13 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter13.Write((System.Single) remaining_distance);
			System.IO.BinaryWriter temp_BinaryWriter14;
			temp_BinaryWriter14 = new System.IO.BinaryWriter(f);
			temp_BinaryWriter14.Write((System.Single) decel_distance);
			f.writeAdapter(endfunc);
		}
		
		/// <summary>Reads the moveinfo from a file. </summary>
		public virtual void  read(QuakeFile f)
		{
			start_origin = f.readVector();
			start_angles = f.readVector();
			end_origin = f.readVector();
			end_angles = f.readVector();
			
			System.IO.BinaryReader temp_BinaryReader;
			temp_BinaryReader = new System.IO.BinaryReader(f);
			temp_BinaryReader.BaseStream.Position = f.Position;
			sound_start = temp_BinaryReader.ReadInt32();
			System.IO.BinaryReader temp_BinaryReader2;
			temp_BinaryReader2 = new System.IO.BinaryReader(f);
			temp_BinaryReader2.BaseStream.Position = f.Position;
			sound_middle = temp_BinaryReader2.ReadInt32();
			System.IO.BinaryReader temp_BinaryReader3;
			temp_BinaryReader3 = new System.IO.BinaryReader(f);
			temp_BinaryReader3.BaseStream.Position = f.Position;
			sound_end = temp_BinaryReader3.ReadInt32();
			
			System.IO.BinaryReader temp_BinaryReader4;
			temp_BinaryReader4 = new System.IO.BinaryReader(f);
			temp_BinaryReader4.BaseStream.Position = f.Position;
			accel = temp_BinaryReader4.ReadSingle();
			System.IO.BinaryReader temp_BinaryReader5;
			temp_BinaryReader5 = new System.IO.BinaryReader(f);
			temp_BinaryReader5.BaseStream.Position = f.Position;
			speed = temp_BinaryReader5.ReadSingle();
			System.IO.BinaryReader temp_BinaryReader6;
			temp_BinaryReader6 = new System.IO.BinaryReader(f);
			temp_BinaryReader6.BaseStream.Position = f.Position;
			decel = temp_BinaryReader6.ReadSingle();
			System.IO.BinaryReader temp_BinaryReader7;
			temp_BinaryReader7 = new System.IO.BinaryReader(f);
			temp_BinaryReader7.BaseStream.Position = f.Position;
			distance = temp_BinaryReader7.ReadSingle();
			
			System.IO.BinaryReader temp_BinaryReader8;
			temp_BinaryReader8 = new System.IO.BinaryReader(f);
			temp_BinaryReader8.BaseStream.Position = f.Position;
			wait = temp_BinaryReader8.ReadSingle();
			
			System.IO.BinaryReader temp_BinaryReader9;
			temp_BinaryReader9 = new System.IO.BinaryReader(f);
			temp_BinaryReader9.BaseStream.Position = f.Position;
			state = temp_BinaryReader9.ReadInt32();
			dir = f.readVector();
			
			System.IO.BinaryReader temp_BinaryReader10;
			temp_BinaryReader10 = new System.IO.BinaryReader(f);
			temp_BinaryReader10.BaseStream.Position = f.Position;
			current_speed = temp_BinaryReader10.ReadSingle();
			System.IO.BinaryReader temp_BinaryReader11;
			temp_BinaryReader11 = new System.IO.BinaryReader(f);
			temp_BinaryReader11.BaseStream.Position = f.Position;
			move_speed = temp_BinaryReader11.ReadSingle();
			System.IO.BinaryReader temp_BinaryReader12;
			temp_BinaryReader12 = new System.IO.BinaryReader(f);
			temp_BinaryReader12.BaseStream.Position = f.Position;
			next_speed = temp_BinaryReader12.ReadSingle();
			System.IO.BinaryReader temp_BinaryReader13;
			temp_BinaryReader13 = new System.IO.BinaryReader(f);
			temp_BinaryReader13.BaseStream.Position = f.Position;
			remaining_distance = temp_BinaryReader13.ReadSingle();
			System.IO.BinaryReader temp_BinaryReader14;
			temp_BinaryReader14 = new System.IO.BinaryReader(f);
			temp_BinaryReader14.BaseStream.Position = f.Position;
			decel_distance = temp_BinaryReader14.ReadSingle();
			endfunc = (EntThinkAdapter) f.readAdapter();
		}
	}
}